Skip to content

Data Noice model for information about datasets#1007

Open
k1o0 wants to merge 4 commits into
masterfrom
DataNotice
Open

Data Noice model for information about datasets#1007
k1o0 wants to merge 4 commits into
masterfrom
DataNotice

Conversation

@k1o0

@k1o0 k1o0 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

This is without the special changelog page which I'll push to iblalyx

@k1o0 k1o0 requested a review from oliche June 25, 2026 12:53

@oliche oliche left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

So I've flagged only a missing migration that may be consolidated, the other comments are flagged by AI and I rephrased them.

Other than that I pushed some changes unworthy of being discussed: ruffed and added a missing field in admin.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I run ./manage.py makemigrations --check I get this:

Migrations for 'data':
  data/migrations/0024_alter_datanotice_options.py
    ~ Change Meta options on datanotice

This need to be shipped with the release, preferably consolidated in a single migration per app !

Comment thread alyx/data/models.py
INSIGNIFICANT = 20

description = models.TextField(blank=True)
importance = models.IntegerField(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagged by AI:

  • alyx/data/models.py (DataNotice.IMPORTANCE) — Hand-rolls an IntEnum + manual choices=[(x.value, x.name) for x in IMPORTANCE] where Django's built-in models.IntegerChoices
    already provides this (enum + choices + .label for free) with less code — worth switching to the built-in rather than reimplementing it.

Comment thread alyx/data/views.py
queryset = super().get_queryset()
queryset = self.serializer_class.setup_eager_loading(queryset)
# For list endpoints, defer large fields not needed in list responses
queryset = queryset.defer('description', 'json')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal if we think there will be less than 100 of such objects but worth excluding those fields altogether in a second serializer if we think we'll have large queries !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants